<?php

namespace app\dao;

use app\model\CareerShowcase;
use app\service\CareerService;

class CareerDao extends BaseDao
{
    private $query;

    protected function setModel()
    {
        return CareerShowcase::class;
    }

    public function __construct()
    {
        $this->query = new CareerShowcase();
    }



    public function getDataById($cid){

        $result = $this->find($cid);

        if (!$result) {
            return [];
        }


        return $result;
    }

    public function upDataById($cid,$data){

        $result = $this->edit($cid,$data);

        if (!$result) {
            return [];
        }

        return $result;
    }


    public function create($data)
    {
        try {
            $model = $this->save($data);
            return $model ? $model->toArray() : [];
        } catch (\Exception $e) {
            throw new \RuntimeException("创建记录失败: " . $e->getMessage());
        }
    }

}